var CryptoJS = require("crypto-js");
const key = CryptoJS.enc.Utf8.parse("jiankangwuyouabc");
/**
 * [encrypt 加密]
 */
function encrypt(content) {
    var encryptResult = CryptoJS.AES.encrypt(content, key, {
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
    });
    // encryptResult = CryptoJS.enc.Base64.stringify(encryptResult);
    // const base64Cipher = encryptResult.ciphertext.toString(CryptoJS.enc.Base64);
    return encryptResult.toString();
}
/**
 * [decrypt 解密]
 */
function decrypt(content) {
    var bytes = CryptoJS.AES.decrypt(content.toString(), key, {
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
    });
    var temp = CryptoJS.enc.Utf8.stringify(bytes);
    return temp;
}
var s = encrypt("{\"rspCode\":\"1\",\"rspData\":{\"body\":[{\"bannerDesc\":\"春暖花开之际，健康南京携手好药师给会员大大们送福利啦！更有药品低至1元哦~\",\"bannerLink\":\"http://mhos.jiankang51.cn/app/article_detail?id=104448\",\"bannerOrder\":1,\"bannerShareLink\":\"\",\"bannerType\":\"08\",\"bannerUrl\":\"http://attachmanager.jiankang51.cn/attachmanager/myrecord/viewimg?imgKey=productBanner_778140919a47457a8a47e564370d6497\",\"createTime\":null,\"createUser\":\"\",\"delFlag\":\"\",\"enableFlag\":\"\",\"endTime\":null,\"id\":\"\",\"productCode\":\"\",\"shareImgUrl\":\"http://attachmanager.jiankang51.cn/attachmanager/myrecord/viewimg?imgKey=productBannerShare_d1353cccca924396b1e798050629bcab\",\"startTime\":null,\"title\":\"大幅折扣来袭，更有健康好礼低至1元！\",\"updateTime\":null,\"updateUser\":\"\"}]},\"rspMsg\":\"\"}");
console.log(s);
console.log(s);
var t = decrypt(s);
console.log(t);

